package exam.common.util;

public class ConverUtils {
	/**
	 * converBooleanToInt
	 * @param bool
	 * @return
	 */
	public static int convertBooleanToInt(boolean bool) {
		return bool?1:0;
	}
	
	/**
	 * converIntToBoolean
	 * @param value
	 * @return
	 */
	public static boolean convertIntToBoolean(int value) {
		return (value == 1)?true:false;
	}
	
	/**
	 * converStringToLong
	 * @param str
	 * @return
	 */
	public static long convertStringToLong(String str) {
		long ret = 0;
		try {
			ret = Long.valueOf(str);
		}catch (NumberFormatException e) {
			ret = -1;
		}
		return ret;
	}
}
